package action.plan;

import java.util.List;

import presentation.PageVO;
import presentation.extendmodel.TdfkfaMainEx;
import presentation.queryvo.PlanListQueryVO;
import service.PlanService;

import com.opensymphony.xwork2.ActionSupport;

import constant.ServiceConstants;

public class ListJudgedPlanAction extends ActionSupport {

    private static final long serialVersionUID = 1L;

    private List<TdfkfaMainEx> planList;

    private PlanService planService;

    private PlanListQueryVO queryVO;

    private PageVO pageVO;

    private String hpyj;

    private Integer planId;

    private String returnCode;

    public String list() throws Exception {

        pageVO.setRecordNum(planService.countJudgedPlan(queryVO));

        planList = planService.getJudgedPlanList(queryVO, pageVO.getIntPageIndex(), pageVO.getIntPageSize());

        return SUCCESS;
    }

    public String passJudgedPlan() throws Exception {

        int ret = planService.passJudgedPlan(planId, hpyj);
        if (ret == ServiceConstants.SUCCESS) {
            returnCode = "success";
        } else {
            returnCode = "failure";
        }
        return SUCCESS;
    }

    public String nopassJudgedPlan() throws Exception {

        int ret = planService.nopassJudgedPlan(planId, hpyj);
        if (ret == ServiceConstants.SUCCESS) {
            returnCode = "success";
        } else {
            returnCode = "failure";
        }
        return SUCCESS;
    }

    public String modifyJudgeJudgedPlan() throws Exception {

        int ret = planService.modifyJudgeJudgedPlan(planId, hpyj);
        if (ret == ServiceConstants.SUCCESS) {
            returnCode = "success";
        } else {
            returnCode = "failure";
        }
        return SUCCESS;
    }

    public List<TdfkfaMainEx> getPlanList() {
        return planList;
    }

    public PlanListQueryVO getQueryVO() {
        return queryVO;
    }

    public void setQueryVO(PlanListQueryVO queryVO) {
        this.queryVO = queryVO;
    }

    public PageVO getPageVO() {
        return pageVO;
    }

    public void setPageVO(PageVO pageVO) {
        this.pageVO = pageVO;
    }

    public String getReturnCode() {
        return returnCode;
    }

    public void setHpyj(String hpyj) {
        this.hpyj = hpyj;
    }

    public void setPlanId(Integer planId) {
        this.planId = planId;
    }

    public void setPlanService(PlanService planService) {
        this.planService = planService;
    }

}
